How to grant read/write to specific user in any existent or future subdirectory of a given directory? [migrated]

Posted by Samuel Rossille on Server Fault See other posts from Server Fault or by Samuel Rossille
Published on 2012-09-28T14:01:00Z Indexed on 2012/09/28 15:40 UTC
Read the original article Hit count: 304

Filed under:
|
|
|

I'm a complete newbie in system administration and I'm doing this as a hobby.

I host my own git repository on a VPS. Let's say my user is john.

I'm using the ssh protocol to access my git repository, so my url is something like ssh://[email protected]/path/to/git/myrepo/.

Root is the owner of everything that's under /path/to/git

I'm attempting to give read/write access to john to everything which is under /path/to/git/myrepo

I've tried both chmod and setfacl to control access, but both fail the same way: they apply rights recursively (with the right options) to all the current existing subdirectories of /path/to/git/myrepo, but as soon as a new directory is created, my user can not write in the new directory.

I know that there are hooks in git that would allow me to reapply the rights after each commit, but I'm starting to think that i'm going the wrong way because this seems too complicated for a very basic purpose.

Q: How should I setup my right to give rw access to john to anything under /path/to/git/myrepo and make it resilient to tree structure change ?

Q2: If I should take a step back change the general approach, please tell me.

© Server Fault or respective owner

Related posts about linux

Related posts about git